<%@page contentType="text/html;charset=utf-8" language="java" import="java.util.*"%>
<jsp:useBean id="publicCheck" scope="request" class="com.pub.check.PublicCheck" />
<jsp:useBean id="WebFunction" scope="request" class="com.pub.web.WebFunction" />
<!-- 以下為DataView 共用設定 -->
<jsp:useBean id="DataViewForm" scope="request" class="com.pub.database.DataViewForm"/>
<jsp:setProperty name="DataViewForm" property="submitMethod" value="POST"/>
<jsp:setProperty name="DataViewForm" property="pageRowCount" value="10"/>
<jsp:setProperty name="DataViewForm" property="nowPageNum"/>
<jsp:setProperty name="DataViewForm" property="dataViewAction"/>
<jsp:setProperty name="DataViewForm" property="filterCol"/>
<jsp:setProperty name="DataViewForm" property="filterValue"/>
<jsp:setProperty name="DataViewForm" property="dvOrderByFields"/>
<jsp:setProperty name="DataViewForm" property="dvOrderBySeq"/>
<% WebFunction.setPortal_to_session(request); //set session from portal
//System.out.println(session.getAttribute("u_id"));
if (session.getAttribute("u_id")==null) {
  session.setAttribute("path",String.valueOf(request.getRequestURI()));
  session.setAttribute("param",null);
  response.sendRedirect("login.jsp?prg_no=/cmr/WKF_JST_ENG.jsp");return; }

  response.setContentType("text/html;charset=BIG5");
  request.setCharacterEncoding("BIG5");
  %>
<%
  ResourceBundle lrbdWEB_Config = ResourceBundle.getBundle("WEB_Config",Locale.getDefault());

  com.pub.database.DataView DataView = new com.pub.database.DataView(lrbdWEB_Config.getString("DB_ALIAS"),
      Boolean.
      valueOf(lrbdWEB_Config.getString("DEBUG")).
      booleanValue(), "BIG5", "BIG5");
  Hashtable lhtPageParameters = new Hashtable();

  String stbSQL="";
  String stbSQLwhere = "";
  String setPageActionURL="";

  DataViewForm.setPageActionURI("WKF_JST_ENG.jsp"+setPageActionURL );
  //stbSQL = "select file_name,file_desc,to_char(upload_date,'yyyy/mm/dd'),'Delete',flow_code,file_id,file_storage,knd,flow_num from " + lstrTableName + " where flow_num='" + lstrFlowNum + "' and knd='"+lstrKnd+"' order by file_id";


  stbSQL+="select wkf_jst_eng.flow_num,wkf_jst_eng.rec_date_time";
  stbSQL+=",pnl_employee.employee_name_c,";
  stbSQL+="floweng_setup.flow_desc, wkf_url.url_wkf";
  stbSQLwhere+=" from wkf_jst_eng,floweng_setup,flow_code,pnl_employee,wkf_url";

  stbSQLwhere+=" where wkf_jst_eng.flow_code in ('CMR','CME') and (flow_code.flow_code = wkf_jst_eng.flow_code (+))";
  stbSQLwhere+=" AND (flow_code.flow_code=wkf_url.flow_code)";
  stbSQLwhere+=" AND ( (floweng_setup.flow_code=wkf_jst_eng.flow_code )";
  stbSQLwhere+=" AND (floweng_setup.flow_no=wkf_jst_eng.flow_no ) )";
  stbSQLwhere+=" AND (pnl_employee.employee_no=wkf_jst_eng.r_empno)";
  stbSQLwhere+=" AND (wkf_jst_eng.jst_flag='N')";
  stbSQLwhere+=" AND (wkf_jst_eng.r_empno='";
  stbSQLwhere+=session.getAttribute("u_id").toString();
 //  stbSQL+=request.getSession().getAttribute("u_id").toString();
  stbSQLwhere+="')";

  if(request.getParameter("flowcode")!=null && !request.getParameter("flowcode").trim().equals("")){
     stbSQLwhere+=" and (wkf_jst_eng.flow_code='";
     stbSQLwhere+=request.getParameter("flowcode");
     stbSQLwhere+="')";

     setPageActionURL+="?flownum=";
     setPageActionURL+=request.getParameter("flownum");
  }

  if(request.getParameter("flownum")!=null && !request.getParameter("flownum").trim().equals("")){
     stbSQLwhere+=" and (wkf_jst_eng.flow_num='";
     stbSQLwhere+=request.getParameter("flownum");
     stbSQLwhere+="')";

     //stbPageActionURL+="?flownum=";
     //stbPageActionURL+=request.getParameter("flownum");
  }
  if(request.getParameter("sempno")!=null && !request.getParameter("sempno").trim().equals("")){
     stbSQLwhere+=" and (wkf_jst_eng.s_empno='";
     stbSQLwhere+=request.getParameter("sempno");

     stbSQLwhere+="')";

      //stbPageActionURI.append("&sempno=");
      //stbPageActionURI.append(request.getParameter("sempno"));
  }
  stbSQLwhere+=" order by wkf_jst_eng.flow_num";

  boolean blnDebug=false;

  String strColRelation[][]=new String[5][];

  strColRelation[0]=new String[8];
  strColRelation[1]=new String[3];
  strColRelation[2]=new String[3];
  strColRelation[3]=new String[3];
  strColRelation[4]=new String[1];

  strColRelation[0][0]="'流程序號'";			//allow show
  strColRelation[0][1]="LINK";
  strColRelation[0][2]="WIDTH='15%'";		//???e??
  strColRelation[0][3]="<a target='_blank' href=";
  //strColRelation[0][3]="<a target='main_frame' href=";
  strColRelation[0][4]="0";
  strColRelation[0][5]="4";
  strColRelation[0][6]="";
  strColRelation[0][7]="0";

  strColRelation[1][0]="'送件時間'";			//allow show
  strColRelation[1][1]="0";
  strColRelation[1][2]="WIDTH='15%'";		//???e??

  strColRelation[2][0]="'送件人'";			//allow show
  strColRelation[2][1]="0";
  strColRelation[2][2]="WIDTH='10%'";		//???e??

  strColRelation[3][0]="'流程站別'";
  strColRelation[3][1]="0";
  strColRelation[3][2]="WIDTH='15%'";

  strColRelation[4][0]="N";
/*
 strColRelation[4][0]="HIDDEN";
 strColRelation[4][1]="INPUT";
 strColRelation[4][2]="0";
 */

 DataViewForm.setColRelation(strColRelation);
  DataViewForm.setPageBtnOnTop(false);
    DataViewForm.setPageBtnOnButtom(true);
    DataViewForm.setFilterShow(false);
    DataViewForm.setJumpPageShow(true);
    DataViewForm.setRowsInfoShow(true);
    DataViewForm.setRowPageShow(true);
    DataViewForm.setExcelShow(false);
    DataViewForm.setOrderEnable(true);
     DataViewForm.setJumpPageButtonShow(true);
DataViewForm.setCountSQL("select nvl(count(*),0)" + stbSQLwhere);
DataViewForm.setSQL(stbSQL +  stbSQLwhere);


%>
<html>

<head>
<title>待處理事項</title>
<LINK HREF="workflow.css" REL="stylesheet" TYPE="text/css">
</head>
<body>
  <h4>待處理事項</h4>
  <form action="WKF_JST_ENG.jsp" method="POST">
    <table>
      <tr>
        <th>流程單別</th>
        <td><input type="text" name="flowcode" size="3" maxlength="3" class="input" /></td>
        <th>流程單號</th>
        <td><input type="text" name="flownum" size="13" maxlength="13" class="input" /></td>
        <th>送件人</th>
        <td><input type="text" name="sempno" size="8" maxlength="8" class="input" /></td>
        <td><input type="submit"  value="查詢" /></td>
      </tr>
    </table>
  </form>
  <%
  //out.println(stbSQL);

   DataView.OutputDataView(DataViewForm, pageContext);
   lrbdWEB_Config= null;
  %>
</body>
</html>
